﻿using System.Runtime.InteropServices;

namespace XYAC.Framework.MonitorTireMaterialOnline
{
    public class User32API
    {
        // 检查窗口是否最小化
        [DllImport("User32.dll")]
        public static extern bool IsIconic(IntPtr hWnd);

        // 将窗口置于前台
        [DllImport("User32.dll")]
        public static extern bool SetForegroundWindow(IntPtr hWnd);

        // 显示窗口（并恢复窗口如果最小化）
        [DllImport("User32.dll")]
        public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);

        // 向窗口发送消息
        [DllImport("User32.dll")]
        public static extern bool PostMessage(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam);

        // 常量定义
        public const int SW_RESTORE = 9;        // 还原窗口状态的命令
        public const int HWND_BROADCAST = 0xffff; // 广播消息给所有顶层窗口
        public const uint WM_SHOWME = 0x0400;   // 自定义的消息ID，用于显示隐藏的窗口


    }
}
